//package org.example.ecsp.vehicle.service.impl;
//
//import cn.tedu.mivos.vehicle.mapper.VehicleMapper;
//import cn.tedu.mivos.vehicle.pojo.dto.VehicleQuery;
//import cn.tedu.mivos.vehicle.pojo.dto.VehicleSaveParam;
//import cn.tedu.mivos.vehicle.pojo.entity.Vehicle;
//import cn.tedu.mivos.vehicle.pojo.vo.VehicleVO;
//import cn.tedu.mivos.vehicle.service.VehicleService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.Date;
//import java.util.List;
//
//@Service
//@Slf4j
//public class VehicleServiceImpl implements VehicleService {
//    @Autowired
//    VehicleMapper vehicleMapper;
//    @Override
//    public List<VehicleVO> selectVehicle(VehicleQuery vehicleQuery) {
//        log.debug("开始处理查询车辆业务，参数：{}", vehicleQuery);
//        List<VehicleVO> list =vehicleMapper.selectVehicle(vehicleQuery);
//        return list;
//    }
//
//    @Override
//    public void saveVehicle(VehicleSaveParam vehicleSaveParam) {
//        log.debug("开始处理保存车辆业务，参数：{}", vehicleSaveParam);
//        Vehicle vehicle=new Vehicle();
//        BeanUtils.copyProperties(vehicleSaveParam,vehicle);
//        if (vehicle.getId()==null){
//            vehicle.setCreateTime(new Date());
//            vehicle.setStatus("1");
//            vehicle.setGeofenceBindStatus("0");
//            vehicleMapper.insert(vehicle);
//        }else {
//            vehicle.setUpdateTime(new Date());
//            vehicleMapper.update(vehicle);
//        }
//    }
//
//    @Override
//    public void deleteVehicle(Long id) {
//        log.debug("开始处理删除车辆业务，参数：{}", id);
//        vehicleMapper.deleteVehicle(id);
//
//    }
//
//    @Override
//    public void unbindVehicle(Long id) {
//        log.debug("开始处理解绑车辆业务，参数：{}", id);
//        Vehicle vehicle=new Vehicle();
//        vehicle.setId(id);
//        vehicle.setGeofenceBindStatus("0");
//        vehicle.setGeofenceId(null);
//        vehicle.setUpdateTime(new Date());
//        vehicleMapper.updateNullValue(vehicle);
//    }
//
//    @Override
//    public void bindVehicle(Long geofenceId, Long vehicleId) {
//        log.debug("开始处理绑定车辆业务，参数：{}", vehicleId);
//        Vehicle vehicle=new Vehicle();
//        vehicle.setId(vehicleId);
//        vehicle.setGeofenceBindStatus("1");//
//        vehicle.setGeofenceId(geofenceId);//
//        vehicle.setUpdateTime(new Date());
//        vehicleMapper.update(vehicle);
//    }
//}
